package com.nulldev.util.web.flexibleKit.scfk.protocols.gopher;

import java.io.InputStream;

import com.nulldev.util.internal.backport.concurrency9.Maps;
import com.nulldev.util.web.flexibleKit.scfk.SCFKRequest;
import com.nulldev.util.web.flexibleKit.scfk.SCFKResponse;
import com.nulldev.util.web.flexibleKit.scfk.io.streams.Stream;
import com.nulldev.util.web.flexibleKit.scfk.protocols.PreferredProtocol;
import com.nulldev.util.web.flexibleKit.scfk.protocols.ProtocolResponse;
import com.nulldev.util.web.flexibleKit.scfk.utils.SCFKIOUtils;

public class GopherResponse implements ProtocolResponse {

	protected static final GopherResponse INSTANCE = new GopherResponse();

	@Override
	public SCFKResponse onResponseRead(final SCFKRequest r, final Stream s) throws Exception {
		final InputStream is = SCFKIOUtils.make(s);
		return new SCFKResponse(PreferredProtocol.GOPHER, 200, Maps.of(), s, is, r);
	}

}
